package br.edu.ufcg.embedded.eolica.domain;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

import br.edu.ufcg.embedded.eolica.util.MySerializableResource;

public class User extends MySerializableResource {
	
	private String username;
	private String password;

	public User() {}
	
	public User(String username, String password) {
		super();
		this.username = username;
		this.password = password;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public void read(InputStream arg0) throws IOException {
		DataInputStream input = new DataInputStream(arg0);
		username = input.readUTF();
		password = input.readUTF();
		input.reset();
		input.close();
	}

	public void write(OutputStream arg0) throws IOException {
		DataOutputStream output = new DataOutputStream(arg0);
		output.writeUTF(username);
		output.writeUTF(password);
		output.flush();
		output.close();
	}
	
	
	
	
}
